package cn.wenxin_zhang.smart4j.plus.helper;

import cn.wenxin_zhang.smart4j.plus.annotation.Mapper;
import cn.wenxin_zhang.smart4j.plus.proxy.MapperManager;
import com.fasterxml.jackson.databind.util.ClassUtil;
import org.apache.commons.dbcp.BasicDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smart4j.framework.helper.BeanHelper;
import org.smart4j.framework.helper.ClassHelper;
import org.smart4j.framework.helper.ConfigHelper;
import org.smart4j.framework.helper.IocHelper;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by Wenxin on 2017/3/5.
 */
public class DBHelper {

    private static final Logger LOGGER = LoggerFactory.getLogger(DBHelper.class);
    private static final Set<Class<?>> MAPPER_CLASS_SET;

    static {
        MAPPER_CLASS_SET = ClassHelper.getClassByAnnotation(Mapper.class);
        for (Class<?> cls:MAPPER_CLASS_SET){
            Object mapperProxy = MapperManager.createMapperProxy(cls);
            BeanHelper.setBean(cls,mapperProxy);
            LOGGER.debug("load mapper:{}",cls.getName());
        }

    }




}
